﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web.UI.WebControls;
using Framework.Library.Core.Utils;
using Framework.Library.Data.DAL;

namespace Framework.Library.Base.DataAccess
{
    public class CmsAccess
    {
        #region ZoneManager        
        public static void LoadCategories(List<TeenioCategory> dtRoles, ListItemCollection lstItems)
        {
            lstItems.Clear();
            if (dtRoles != null)
            {
                foreach (TeenioCategory row in dtRoles)
                {
                    var item = new ListItem(row.ZONE_NAME, row.ZONE_ID.ToString());
                    lstItems.Add(item);
                }
            }
        }

        public static void LoadCategories(List<TeenioCategory> dtRoles, TreeNodeCollection lstItems)
        {
            lstItems.Clear();
            if (dtRoles != null)
            {
                foreach (TeenioCategory row in dtRoles)
                {
                    var childNode = new TreeNode(row.ZONE_NAME, row.ZONE_ID.ToString());
                    childNode.Expanded = false;
                    lstItems.Add(childNode);
                }
            }
        }

        public static void LoadZones(List<TeenioZone> dtRoles, ListItemCollection lstItems)
        {
            lstItems.Clear();
            if (dtRoles != null)
            {
                foreach (TeenioZone row in dtRoles)
                {
                    var item = new ListItem(row.NAME, row.ID.ToString());
                    lstItems.Add(item);
                }
            }
        }

        public static void LoadZones(List<TeenioZone> dtRoles, TreeNodeCollection lstItems)
        {
            lstItems.Clear();           
            if (dtRoles != null)
            {
                foreach (TeenioZone row in dtRoles)
                {
                    var childNode = new TreeNode(row.NAME, row.ID.ToString());
                    childNode.Expanded = false;
                    lstItems.Add(childNode);
                }
            }
        }

        #endregion
    }
}